/***********************************************************************
 * Module:  BoiteVitesse.java
 * Author:  a.kanwar
 * Purpose: Defines the Class BoiteVitesse
 ***********************************************************************/

import java.util.*;


public class BoiteVitesse {
   
   /**************************************************
    * Attribute
    *************************************************/ 
    
   private int idBt;
   private java.lang.String libelle;
   private java.util.Collection<Vehicule> vehicule;

   
   /*******************************************************
   *Constructor
   ********************************************************/
   
   
    public BoiteVitesse(int idBt, String libelle, Collection<Vehicule> vehicule) {
        this.idBt = idBt;
        this.libelle = libelle;
        this.vehicule = vehicule;
    }

    public BoiteVitesse(String libelle, Collection<Vehicule> vehicule) {
        this.libelle = libelle;
        this.vehicule = vehicule;
    }

    
    
    /**********************************************************
     * 
     * Getter and Setter 
     **********************************************************/
    
    public int getIdBt() {
        return idBt;
    }

    public void setIdBt(int idBt) {
        this.idBt = idBt;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }

    @Override
    public String toString() {
        return "BoiteVitesse{" + "idBt=" + idBt + ", libelle=" + libelle + ", vehicule=" + vehicule + '}';
    }
    
    
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   /********************************************************
    * generate by code power AMC
    ********************************************************/
   
   
   /** @pdGenerated default getter */
   public java.util.Collection<Vehicule> getVehicule() {
      if (vehicule == null)
         vehicule = new java.util.HashSet<Vehicule>();
      return vehicule;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorVehicule() {
      if (vehicule == null)
         vehicule = new java.util.HashSet<Vehicule>();
      return vehicule.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newVehicule */
   public void setVehicule(java.util.Collection<Vehicule> newVehicule) {
      removeAllVehicule();
      for (java.util.Iterator iter = newVehicule.iterator(); iter.hasNext();)
         addVehicule((Vehicule)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newVehicule */
   public void addVehicule(Vehicule newVehicule) {
      if (newVehicule == null)
         return;
      if (this.vehicule == null)
         this.vehicule = new java.util.HashSet<Vehicule>();
      if (!this.vehicule.contains(newVehicule))
      {
         this.vehicule.add(newVehicule);
         newVehicule.setBoiteVitesse(this);      
      }
   }
   
   /** @pdGenerated default remove
     * @param oldVehicule */
   public void removeVehicule(Vehicule oldVehicule) {
      if (oldVehicule == null)
         return;
      if (this.vehicule != null)
         if (this.vehicule.contains(oldVehicule))
         {
            this.vehicule.remove(oldVehicule);
            oldVehicule.setBoiteVitesse((BoiteVitesse)null);
         }
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllVehicule() {
      if (vehicule != null)
      {
         Vehicule oldVehicule;
         for (java.util.Iterator iter = getIteratorVehicule(); iter.hasNext();)
         {
            oldVehicule = (Vehicule)iter.next();
            iter.remove();
            oldVehicule.setBoiteVitesse((BoiteVitesse)null);
         }
      }
   }

}